package com.fly;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Fly on 2017/8/1.
 */
@RestController
@RequestMapping("/hello")
public class HelloController {

   /* @Value("${cupSize}")
    private String cupSize;*/

    @Autowired
    private GirlProperties girlProperties;

    /**
     * url模式 http://127.0.0.1:8080/girl/hello/say/23
     * @param id
     * @return
     */
    @RequestMapping(value = {"/say/{id}","/hi"},method = RequestMethod.GET)
    public String say(@PathVariable("id") Integer id){
      //  return girlProperties.getCupSize();
        return "id:" + id;
    }

    @GetMapping(value = "/say")
   // @RequestMapping(value = "/say",method = RequestMethod.GET)
    public String sayOne(@RequestParam(value = "id", required = false,defaultValue = "0")Integer myId){
        return "id:" + myId;
    }
}
